/*
 * @lc app=leetcode.cn id=506 lang=javascript
 *
 * [506] 相对名次
 */

// @lc code=start
/**
 * @param {number[]} score
 * @return {string[]}
 */
var findRelativeRanks = function(score) {
    let result = []
    let arr = [...score]
    score.sort((a, b) => b - a)

    arr.map((e, i) => {
        let no = ''
        if (e === score[0]) {
            no = 'Gold Medal'
        } else if (e === score[1]) {
            no = 'Silver Medal'
        } else if (e === score[2]) {
            no = 'Bronze Medal'
        } else {
            no = score.indexOf(e) + 1 + ''
        }
        result[i] = no
    })
    return result
};
// @lc code=end

